package pers.wensheng.patterns.creator_pattern.factory_pattern.factory_method_pattern;


import pers.wensheng.patterns.creator_pattern.factory_pattern.factory_method_pattern.entity.Coffee;
import pers.wensheng.patterns.creator_pattern.factory_pattern.factory_method_pattern.factory.CoffeeFactory;

/**
 *  咖啡馆
 */
public class CoffeeStore {
    /**
     *  私有的工厂对象
     */
    private CoffeeFactory coffeeFactory;
    public CoffeeStore(CoffeeFactory coffeeFactory){
        this.coffeeFactory = coffeeFactory;
    }
    public void setFactory(CoffeeFactory coffeeFactory){
        this.coffeeFactory = coffeeFactory;
    }
    /**
     *  点咖啡功能
     *  这里就不需要参数了
     * @return
     */
    public Coffee orderCoffee(){
        Coffee coffee = coffeeFactory.createCoffee();

        //加配料
        coffee.addSugar();
        coffee.addMilk();
        return coffee;
    }
}
